package com.enation.app.javashop.api.client;

import com.enation.app.javashop.service.goodssearch.GoodsIndexManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;

/**
 * @author fk
 * @version v2.0
 * @Description:
 * @date 2018/8/15 9:49
 * @since v7.0.0
 */
@RestController
@RequestMapping("/client/goods-index")
@ApiIgnore
public class GoodsIndexClientController {

    @Autowired
    private GoodsIndexManager goodsIndexManager;

    @PostMapping
    public void addIndex(@RequestBody Map goods) {
        goodsIndexManager.addIndex(goods);
    }

    @PostMapping("/update")
    public void updateIndex(@RequestBody Map goods) {
        goodsIndexManager.updateIndex(goods);

    }

    @PostMapping("/delete")
    public void deleteIndex(@RequestBody Map goods) {
        goodsIndexManager.deleteIndex(goods);
    }

    @PostMapping("/all")
    public boolean addAll(@RequestBody List<Map<String, Object>> list, @RequestParam("index") int index) {
        return goodsIndexManager.addAll(list,index);
    }


}
